﻿using System;
using System.Collections.Generic;
using System.Data;
using DFT.DB;

namespace DFT.AJAX
{
    public partial class GetProfileDetails : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            List<String> keys = new List<String>();
            foreach (String key in Session.Keys)
            {
                if (key.StartsWith("image"))
                {
                    keys.Add(key);
                }
            }
            foreach (String key in keys)
            {
                Session.Remove(key);
            }

            DataTable dt = new DataTable();
            if (DBManager.GetProfileDetails(Int64.Parse(Request.QueryString["profId"]), ref dt))
            {
                Response.ContentType = "text/xml";

                Response.Write("<?xml version='1.0' encoding='utf-8'?>");
                Response.Write("<Data>");
                Response.Write("<fName>" + dt.Rows[0]["firstName"].ToString() + "</fName>");
                Response.Write("<lName>" + dt.Rows[0]["lastName"].ToString() + "</lName>");
                Response.Write("<address>" + dt.Rows[0]["address"].ToString() + "</address>");
                Response.Write("<birthDate>" + dt.Rows[0]["birthDate"].ToString() + "</birthDate>");
                Response.Write("<gender>" + dt.Rows[0]["gender"].ToString() + "</gender>");
                Response.Write("<isDeath>" + dt.Rows[0]["isDeath"].ToString() + "</isDeath>");
                Response.Write("<deathDt>" + dt.Rows[0]["deathDt"].ToString() + "</deathDt>");
                Response.Write("<socialStatus>" + dt.Rows[0]["socialStatus"].ToString() + "</socialStatus>");
                Response.Write("<acadimicQual>" + dt.Rows[0]["acadimicQual"].ToString() + "</acadimicQual>");
                Response.Write("<country>" + dt.Rows[0]["country"].ToString() + "</country>");
                Response.Write("<city>" + dt.Rows[0]["city"].ToString() + "</city>");
                Response.Write("<blodType>" + dt.Rows[0]["blodType"].ToString() + "</blodType>");
                Response.Write("<religion>" + dt.Rows[0]["religion"].ToString() + "</religion>");
                Response.Write("</Data>");

                Response.End();
            }
        }
    }
}